<!DOCTYPE html>
<html lang="en">

<head>
    <link rel="stylesheet" href="./css/base.css" />
    <link rel="stylesheet" href="../../static/element-ui/theme-chalk/index.css" />
</head>

<body>
    <div id="my-app">
        <my-component></my-component>
        <xiaomei class="xiaomei" />
    </div>

    <script src="../../static/vue/vue.js"></script>
    <script src="../../static/vue/vue-router.js"></script>
    <script src="../../static/vue/httpVueLoader.js"></script>
    <script src="../../static/vue/axios.min.js"></script>
    <script src="../../static/element-ui/index.js"></script>

    <!-- 引入iconfont -->
    <link rel="stylesheet" href="./components/wifi/icon/iconfont.css" />
    <script type="text/javascript">
        // 获取地址栏地址
        function urlget() {
          var hash = window.location.hash;
          hash = hash.substr(1);
          var path_split = hash.split("?");
          var base_path = "/404";
          base_path = path_split[0];
          if (base_path.search("^\/plugin\/") >= 0) {
            // console.log("base_path_1:", base_path + ".vue");
  
            return base_path + ".vue";
          } else {
            // 默认走这里
            if (base_path == "/") {
              // base_path = '/index/index'
              base_path = "/Home";
            }
            // console.log("base_path_2:", "./components" + base_path + ".vue");
  
            return "./components" + base_path + ".vue";
          }
        }
  
        // Vue.use(httpVueLoader);
        var router = new VueRouter();
  
        // 重写路由跳转
        router.replace = function (urlobj) {
          // console.log("router.replace.urlobj:", urlobj);
  
          var gourl = "./index.html#" + urlobj.path;
          var query_str = "";
          if (urlobj.query && urlobj.query.length > 0) {
            var query = urlobj.query;
            for (const key in query) {
              if (query.hasOwnProperty(key)) {
                const element = query[key];
                query_str += key.toString() + "=" + element.toString() + "&";
              }
            }
            gourl = gourl + "?" + query_str.replace(/^\&+|\&+$/gm, "");
          }
          window.location.href = gourl;
          window.location.reload();
        };
  
        new Vue({
          el: "#my-app",
          data() {
            return {
              rul: "",
            };
          },
  
          components: {
            "my-component": httpVueLoader(urlget()),
            xiaomei: httpVueLoader("./components/xiaomei/xiaomei.vue"),
          },
  
          router,
        });
      </script>
</body>

<style>
    body {
        width: 100%;
        height: 100%;
    }

    #my-app {
        position: relative;
        width: 100%;
        height: 100%;
    }

    .xiaomei {
        position: fixed;
        bottom: 10px;
        right: 10px;
        z-index: 99999;
    }
</style>

</html>